CC = g++
PYLIB = -I/usr/include/python3.8
# JPGLIB =  -I/opt/libjpeg-turbo/include -L/opt/libjpeg-turbo/lib64 -lturbojpeg
JPGLIB =  -I/opt/libjpeg-turbo/include /opt/libjpeg-turbo/lib64/libturbojpeg.a

# export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64:$LD_LIBRARY_PATH
jpgLoader.so: jpgLoader.o zq_loader.o py_wrapper.o
	$(CC) -O2 -Wall -shared -std=c++11 -fPIC $^ -o $@ $(PYLIB) $(JPGLIB)

jpgLoader.o: jpgLoader.cpp jpgLoader.h common.h zq_loader.h queue_mt.h counter_mt.h
	$(CC) -c -O2 -Wall -std=c++11 -fPIC $< -o $@ $(PYLIB) -lpthread

zq_loader.o: zq_loader.cpp zq_loader.h common.h jpgLoader.h queue_mt.h counter_mt.h
	$(CC) -c -O2 -Wall -std=c++11 -fPIC $< -o $@ $(JPGLIB) -lpthread

py_wrapper.o: py_wrapper.cpp common.h jpgLoader.h
	$(CC) -c -O2 -Wall -std=c++11 -fPIC $< -o $@ $(PYLIB) -lpthread

clean:
	rm *.o *.so
